package com.smartcat.web.actions;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;

import com.smartcat.model.TranslateData;
import com.smartcat.service.StudyService;
import com.smartcat.web.BaseAction;
import com.smartcat.web.SplitPage;
@Controller
public class StudyAction extends BaseAction{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	static final Logger logger=Logger.getLogger(StudyAction.class);
	
	private StudyService studyService;
	
	private int start;
	private int num;
	
	public void setStudyService(StudyService studyService) {
		this.studyService = studyService;
	}

	@Override
	public String execute(){
		start=0;
		num=15;
		return moreInfo();
	}
	
	public String moreInfo(){
		logger.info("prepare study data......");
		SplitPage sp=new SplitPage(start,num);
		List<TranslateData> transList=studyService.getTranslateInfo(getLoginUser().getUserId(),sp);
		putToValueStack("TranslateDataList", transList);
		putToValueStack("splitPage", sp);
		logger.info("prepared successful......");
		return SUCCESS;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}
	
	
	

}
